<template>
	<view class="product-info">
		<text class="product-name"></text>
	</view>
</template>

<script setup lang="ts">
import { computed } from 'vue';

const props = defineProps<{
	isMultiPackage: string | number;
	productCollection: any[];
	childrens: any[];
	productName: string;
	totalUnitNum: number;
	actualPrice: string | number;
	orderPrice: string | number;
	totalAmount: string | number;
}>();

const goodsTotal = computed(() => {
	// 判断是否是多包裹
	if (props.isMultiPackage == 1) {
		return props.childrens.reduce((sum, item) => sum + item.productCollection.reduce((s, i) => s + (parseInt(i.num) || 0), 0) || 0, 0);
	}

	return props.productCollection.reduce((sum, item) => sum + (parseInt(item.num) || 0), 0);
});
</script>

<style scoped>
.product-info {
	display: flex;
	align-items: center;
	gap: 12rpx;
	margin-bottom: 16rpx;
}
.product-name {
	font-weight: 500;
	font-size: 28rpx;
	flex: 1;
}
.quantity {
	font-size: 26rpx;
	color: #666;
}
</style>
